<template>
	<!-- 商家扫码核销成功 -->
	<view class="w_wp">
		<view class="w_info">
			<view class="w_name">
				<text>会员 {{info.nickname}}</text>
				<text>下单时间 {{info.createtime}}</text>
			</view>
			<view class="w_order">
				<text>订单号 {{info.ordersn}}</text>
				<text></text>
			</view>
			<view class="w_li">
				<image :src="info.thumb" mode=""></image>
			</view>
			<view class="w_li">
				<text class="goods_title">{{info.goodstitle}}</text>
			</view>
			<view class="w_li">
				<text>价格 {{info.price}}元</text>
			</view>
			<view class="w_li">
				<text>数量 {{info.total||1}}份</text>
			</view>
			<!-- <view class="w_li w_flex">
				<text>选择核销数量：</text>
				<uni-number-box style="transform: scale(1.15);" :min="1" :max="info.lastnum" v-model="number"></uni-number-box>
			</view> -->
			<view class="w_li">
				<text>支付时间 {{info.paytime}}</text>
			</view>
			<view class="w_bottom" @click="submit"><text>确认核销</text></view>
			<view class="w_bottom1" @click="$navTo('/pages/index/index')"><text>返回首页</text></view>
		</view>
	</view>
	

</template>

<script>
	export default {
		data() {
			return {
				content: '',
				sig: '',
				info: {
					ordersn: '',
					nickname: '',
					price: '',
					createtime: '',
					paytime: '',
					thumb:'',
					goodstitle:'',
					
				},
				number: 1,
			}
		},
		onLoad(option) {
			if (option.scene) {
				this.content = this.gup('content', '?' + option.scene);
				this.sig = this.gup('sig', '?' + option.scene);
			} else if (option.q) {
				let scan_url = decodeURIComponent(option.q);
				this.content = this.gup('content', scan_url);
				this.sig = this.gup('sig', scan_url);
			} else {
				this.content = option.content;
				this.sig = option.sig;
			}
			this.getInfo();
		},
		methods: {
			gup(name, url) {
				if (!url) url = location.href;
				name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
				var regexS = "[\\?&]" + name + "=([^&#]*)";
				var regex = new RegExp(regexS);
				var results = regex.exec(url);
				return results == null ? null : results[1];
			},
			getInfo() {
				this.$axios('order/getDHInfo', 'POST', 'supplier', {
					content: this.content,
					sig: this.sig
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data;
					}
				})
			},
			submit() {
				this.$axios('order/dh', 'POST', 'supplier', {
					id: this.info.id
				}).then(res => {
					if (res.data.code == 200) {
						this.$api.msg('核销成功！');
						setTimeout(() => {
							this.$navTo('../business/orderwrite?status=3')
						}, 1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f2f2f2;
	}

	.w_wp {
		color: $font-color-dark;
		padding-bottom: 130upx;
	}

	.w_info {
		background-color: #fff;
		padding: 20upx;
	}

	.w_name,
	.w_order {
		line-height: 80upx;
	}
	.w_flex{
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.w_name {
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-weight: bold;
	}

	.w_order {
		font-weight: bold;
		font-size: 26upx;
		text-align: center;
	}

	.w_money {
		color: $base-color;
	}

	.w_li {
		text-align: center;
		font-weight: bold;
		line-height: 60upx;
	}

	.w_li image {
		height: 120upx;
		width: 120upx;
		border-radius: 10upx;

		
	}

	.goods_title {
		display: inline-block;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		width: 80%;
	}

	.w_bottom {
		background: $base-color;
		border-radius: 10upx;
		color: #fff;
		margin: 40upx 0;
		line-height: 70upx;
		letter-spacing: 1px;
		text-align: center;
	}
	.w_bottom1{
		background: #999;
		border-radius: 10upx;
		color: #fff;
		margin: 40upx 0;
		line-height: 70upx;
		letter-spacing: 1px;
		text-align: center;
	}
</style>